<core:SET width='200'>
<core:SET content="content">

<core:SET title="Articles management">
<core:WRAP file="/adm/adm.layout.html" placeholder="Content">

<core:include file="/adm/inc/inc.adm.tabs.html">

<h1 align="center"> </h1>

<SCRIPT language="javascript" src="include/zts_picker.js"></SCRIPT>
<script language="javascript">
    function showStartDateCalendar() {
        var day = document.FilterForm.start_day.value;
        var month = document.FilterForm.start_month.selectedIndex;
        var year = document.FilterForm.start_year.value;
        var dt = new Date();
    	if (day>=1 && month>=1 && year>=2000) dt = new Date(year,month-1,day);
    	var str_dt = dt2dtstr(dt);
    	//alert(str_dt);
    	show_calendar('setStartDate',str_dt);
    }
	function setStartDate(str_dt) {
			//alert(str_dt);
			var dt_datetime = (str_dt == null || str_dt =="" ?  new Date() : str2dt(str_dt));
			var month = dt_datetime.getMonth()+1;
			//alert(month);
			var day = dt_datetime.getDate();
            var year = dt_datetime.getYear();
            //alert(day);
            document.FilterForm.start_day.value = day;
            document.FilterForm.start_year.value = year;
            document.FilterForm.start_month.selectedIndex = month;
	}

    function showEndDateCalendar() {
        var day = document.FilterForm.end_day.value;
        var month = document.FilterForm.end_month.selectedIndex;
        var year = document.FilterForm.end_year.value;
        var dt = new Date();
    	if (day>=1 && month>=1 && year>=2000) dt = new Date(year,month-1,day);
    	var str_dt = dt2dtstr(dt);
    	show_calendar('setEndDate',str_dt);
    }
    function setEndDate(str_dt) {
			//alert(str_dt);
			var dt_datetime = (str_dt == null || str_dt =="" ?  new Date() : str2dt(str_dt));
			var month = dt_datetime.getMonth()+1;
			//alert(month);
			var day = dt_datetime.getDate();
            var year = dt_datetime.getYear();
            //alert(day);
            document.FilterForm.end_day.value = day;
            document.FilterForm.end_year.value = year;
            document.FilterForm.end_month.selectedIndex = month;
	}
</SCRIPT>

<form id="FilterForm" name="FilterForm" method="post" action="" runat="server">
<core:optional for="msg">
	<span class="message" runat="server"> {$msg} </span>
</core:optional>
	<hr>

 <!-- articles filter -->
 <table width="100%" border="0" align="center" cellspacing="1" cellpadding="2">
 	<tr>
 		<td>
        	<table width="100%" border="0" align="center" cellspacing="1" cellpadding="2">
                <tr valign="top">
      				<td class="form_field" width="25%">
                        <input name="filter_article_id" type="checkbox" id="filter_article_id" value="article_id" runat="server">
      					<label for="article_id" runat="server">ID:</label>
      				</td>
      				<td class="form_field">
      					<input name="article_id" type="text" id="article_id" size="10" runat="server">
      				</td>
    			</tr>
                <tr valign="top">
      				<td class="form_field">
                        <input name="filter_headline" type="checkbox" id="filter_headline" value="filter_headline" runat="server">
      					<label for="headline" runat="server">Headline:</label>
      				</td>
      				<td class="form_field">
      					<input name="headline" type="text" id="headline" size="56" runat="server">
      				</td>
    			</tr>
                <tr valign="top">
      				<td class="form_field">
                        <input name="filter_category1" type="checkbox" id="filter_category1" value="filter_category1" runat="server">
      					<label for="category1" runat="server">Sport category:</label>
      				</td>
      				<td class="form_field">
                        <select name="category1" id="category1" runat="server">
                        </select>
      				</td>
    			</tr>
                <tr valign="top">
      				<td class="form_field">
                        <input name="filter_category2" type="checkbox" id="filter_category2" value="filter_category2" runat="server">
      					<label for="category2" runat="server">Community category:</label>
      				</td>
      				<td class="form_field">
                        <select name="category2" id="category2" runat="server">
                        </select>
      				</td>
    			</tr>
                 <tr valign="top">
      				<td class="form_field">
                        <input name="filter_author" type="checkbox" id="filter_author" value="filter_author" runat="server">
      					<label for="author" runat="server">Author:</label>
      				</td>
      				<td class="form_field">
                        <select name="author" id="author" runat="server">
                        </select>
      				</td>
    			</tr>
        	</table>
 		</td>
 		<td>
        	<table width="100%" border="0" align="center" cellspacing="1" cellpadding="2">
                <tr valign="top">
      				<td class="form_field">
                        <input name="start_date_filter" type="checkbox" id="start_date_filter" value="1" runat="server">
      					<label for="start_day" runat="server">Start Date:</label>
      				</td>
      				<td class="form_field">
                        <input name="start_day" type="text" id="start_day" size="2" runat="server">
                        <select name="start_month" id="start_month" runat="server">
                        </select>
                        <input name="start_year" type="text" id="start_year" size="4" runat="server">
                        <a href="javascript:showStartDateCalendar();">
                          <img height=20  src="images/calendar.gif" width=20 border=0 >
                        </a>
      				</td>
    			</tr>
                <tr valign="top">
      				<td class="form_field">
                        <input name="end_date_filter" type="checkbox" id="end_date_filter" value="1" runat="server">
      					<label for="end_date" runat="server">End Date:</label>
      				</td>
      				<td class="form_field">
                        <input name="end_day" type="text" id="end_day" size="2" runat="server">
                        <select name="end_month" id="end_month" runat="server">
                        </select>
                        <input name="end_year" type="text" id="end_year" size="4" runat="server">
                        <a href="javascript:showEndDateCalendar();">
                          <img height=20  src="images/calendar.gif" width=20 border=0 >
                        </a>
      				</td>
    			</tr>
                <tr valign="top">
      				<td class="form_field">
                        <input name="recent_filter" type="checkbox" id="recent_filter" value="1" runat="server">
      					<label for="recent" runat="server">Recent:</label>
      				</td>
      				<td class="form_field">
                        <select name="recent" id="recent" runat="server">
                        </select>
      				</td>
    			</tr>
                <tr valign="top">
      				<td class="form_field">
      					<label for="sort" runat="server">Sort By:</label>
      				</td>
      				<td class="form_field">
                        <select name="sort" id="sort" runat="server">
                        </select>
      				</td>
    			</tr>
                <tr valign="top">
      				<td class="form_field" colspan="2">
                     	<input name="apply" type="submit" id="apply" value="List articles" runat="server">
      				</td>
    			</tr>

        	</table>
 		</td>
 	</tr>
 </table>

  <!-- articles list -->
  <table width="100%" border="0" align="center" cellspacing="1" cellpadding="2">
    <colgroup>
        <col id="ID">
        <col id="category">
        <col id="header">
        <col id="date_added">
        <col id="author">
        <col id="action">
    </colgroup>
    <tr align="left">
    	<td colspan="3" class="whiteheader">
    		Manage articles
		</td>

<list:LIST id='List'>
        <td colspan="3" class="whiteheader_right" align="right">
            <page:navigator id="pagenav" items="10">
				Page: {$PageNumber} of {$TotalPages}
    			<page:first>First</page:first>
    			<page:prev>Prev</page:prev>
    			<page:list>
        			<page:number>
        			<page:elipses>...</page:elipses>
        			<page:separator> </page:separator>
    			</page:list>
    			<page:next>Next</page:next> <page:last>Last</page:last>
			</page:navigator>
    	</td>
     </tr>

    <tr class="header">
        <th>ID</th>
        <th>Category</th>
        <th>Header</th>
        <th>Date posted</th>
        <th>Author</th>
        <th> &nbsp; </th>
    </tr>
    <list:ITEM>
      <tr class="{$Parity}">
        <td class="rightblack">
        	<core:optional for="premium_show">
        		<img src="images/blue ticket.gif"/>
        	</core:optional>
        	{$article_id}
        </td>
        <td class="rightblack">{$category_show}</td>
        <td class="rightblack">{$headline}</td>
        <td class="rightblack">{$date_added}</td>
        <td class="rightblack">{$author_show}</td>


        <td class="left">
        	<html:link url="/delete" param="article_id">Delete</html:link>
        	<html:link url="/edit" param="article_id">Edit</html:link>
        </td>
      </tr>
    </list:ITEM>

    <!--<tr> <td colspan="6" class="whiteheader"> &nbsp; </td> </tr> -->
    <tr align="left">
    	<td colspan="3" class="whiteheader">
    		Manage articles
		</td>

        <td colspan="3" class="whiteheader_right" align="right">
            <page:navigator id="pagenav2" items="10">
				Page: {$PageNumber} of {$TotalPages}
    			<page:first>First</page:first>
    			<page:prev>Prev</page:prev>
    			<page:list>
        			<page:number>
        			<page:elipses>...</page:elipses>
        			<page:separator> </page:separator>
    			</page:list>
    			<page:next>Next</page:next> <page:last>Last</page:last>
			</page:navigator>
    	</td>
     </tr>
  </table>
</list:LIST>
<!--</core:default>   -->

<hr>

<html:link url="/create" param="article_id">Create a new article</html:link>

</form>